package cn.cvs.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping(value = "/hello")
public class SjiController extends AbstractController {
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("实战训练1");
        return new ModelAndView("test");
    }
    public class sji2 {
        @RequestMapping("/test2")
        public String Sj() {
            System.out.println("我的第一个SpringMVC程序");
            return "test";
        }
        @RequestMapping(value = "/test3", method = RequestMethod.POST)
        public ModelAndView task3(@RequestParam String name) {
            ModelAndView mv = new ModelAndView();
            mv.addObject("name", name);
            mv.setViewName("sj3");
            return mv;
        }
    }
}
